package com.zelin.gateway.config;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created by WF on 2020/8/1 15:47
 */
@Configuration
public class GatewayConfig {
    @Bean
    public RouteLocator customRouteLocator(RouteLocatorBuilder rb){
        RouteLocatorBuilder.Builder routes = rb.routes();
        //http://localhost:8888/stud
        return  routes.route("route_path2",r -> r.path("/stud/**").uri("http://localhost:9001"))
                      .route("route_path3",r->r.path("/user/**","/admin/**").uri("lb://tensquare-user"))
                      .build();
       //http://localhost:9999/admin/login

       //http://localhost:9010/admin/login
    }
}
